
# 内容如下

#!/bin/bash

mongo <<EOF

use admin;

db.createUser({

user: "admin",

pwd: "123456",

roles: [ { role: "root", db: "admin" } ],

mechanisms : ["SCRAM-SHA-1"]

});

use iecg;

db.createUser(

{

user: "iecg-mongo",

pwd: "mongo-Aa123456",

roles: [

{role:"read",db:"admin"},

{ role: "readWrite", db: "iecg"}

],

mechanisms : ["SCRAM-SHA-1"]

}

);

db.createCollection("member");

db.member.insert(

{

"user_name" : "admin",

"password" : "fe10adce3949ba59bbe56e05f7f2f883e",

"company" : "公司名称",

"contact_number" : "13188888888",

"validity" : 1562774400,

"create_time" : 1562607938,

"update_time" : 1562607938,

"role" : 1,

"status" : 1,

"del" : 0

}

);

EOF